package com.wx.gof.pattern.behavioral.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName CourseAggregateImpl
 * @Author wx
 * @Description 课程集合实现
 * @Date 2018-12-12-22:49
 */
public class CourseAggregateImpl implements CourseAggregate {
    List<Course> courseList;

    public CourseAggregateImpl() {
        this.courseList = new ArrayList<>();
    }

    @Override
    public void addCourse(Course course) {
        courseList.add(course);
    }

    @Override
    public void removeCourse(Course course) {
        courseList.remove(course);
    }

    @Override
    public CourseIterator getCourseIterator() {
        return new CourseIterator(this.courseList);
    }
}
